import shutil
import os
 
# 源文件夹路径
source_folder = r"C:\Users\wangwenli\Pictures\1"
# 目标文件夹路径
destination_folder = r"C:\Users\wangwenli\Pictures\aaa_tmp"

# 确保目标文件夹存在，如果不存在则创建  
os.makedirs(destination_folder, exist_ok=True)

# 遍历源文件夹中的所有文件
for filename in os.listdir(source_folder):
    # print(filename)
    source_file_path = os.path.join(source_folder, filename)
    destination_file_path = os.path.join(destination_folder, filename)
    # 移动文件
    shutil.move(source_file_path, destination_file_path)
print('迁移成功')